//	mpsf.looppts.h
#pragma once

#define WIN_VERSION
#define _CRT_SECURE_NO_DEPRECATE
#include <max/ext.h>
#include <max/ext_obex.h>

//typedef double t_ms;
typedef float t_ms;

#define LP_INLET_LOOPSTART		0
#define LP_INLET_LOOPEND		1
#define LP_INLET_LOOPCENTER	2
#define LP_INLET_LOOPLENGTH	3
#define LP_INLET_SAMPLENGTH	4

#define LP_PROXY_LOOPEND		(LP_INLET_LOOPEND - 1)
#define LP_PROXY_LOOPCENTER	(LP_INLET_LOOPCENTER - 1)
#define LP_PROXY_LOOPLENGTH	(LP_INLET_LOOPLENGTH - 1)
#define LP_PROXY_SAMPLENGTH	(LP_INLET_SAMPLENGTH - 1)

#define LP_OUTLET_LOOPSTART	0
#define LP_OUTLET_LOOPEND		1
#define LP_OUTLET_LOOPCENTER	2
#define LP_OUTLET_LOOPLENGTH	3

#define LP_NUM_INLETS	5
#define LP_NUM_PROXIES	(LP_NUM_INLETS - 1)
#define LP_NUM_OUTLETS 4

typedef struct _lppts_t
{
	t_object _obj;
	void *_obex;
	t_ms _loopstart;
	t_ms _loopend;
	t_ms _loopcenter;
	t_ms _looplength;
	t_ms _samplength;
	void *_proxy[LP_NUM_PROXIES];
	void *_outlet[LP_NUM_OUTLETS];
	long _inletnumber;
	/*void *_outloopstart;
	void *_outloopend;
	void *_outloopcenter;
	void *_outlooplength;*/
} t_lppts;

void* lp_new(t_symbol *sym, long argc, t_atom *argv);
void lp_free(t_lppts *x);
void lp_loopstart(t_lppts *x, t_ms f);
void lp_loopend(t_lppts *x, t_ms f);
void lp_loopcenter(t_lppts *x, t_ms f);
void lp_looplength(t_lppts *x, t_ms f);
void lp_samplength(t_lppts *x, t_ms f);
void lp_float(t_lppts *x, t_ms f);
void lp_int(t_lppts *x, long n);
void lp_bang(t_lppts *x);

//t_max_err lp_getloopstart(t_lppts *x, void *attr, long *argc, t_atom **argv);
t_max_err lp_setloopstart(t_lppts *x, void *attr, long argc, t_atom *argv);
t_max_err lp_setloopend(t_lppts *x, void *attr, long argc, t_atom *argv);
t_max_err lp_setloopcenter(t_lppts *x, void *attr, long argc, t_atom *argv);
t_max_err lp_setlooplength(t_lppts *x, void *attr, long argc, t_atom *argv);
t_max_err lp_setsamplength(t_lppts *x, void *attr, long argc, t_atom *argv);


